package com.dd.common.dto.system.log;

import com.dd.common.validator.annotation.ValidTimeRange;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.PastOrPresent;
import java.time.LocalDateTime;

/**
 * @author cheng
 */
@ValidTimeRange(start = "createdAtStart", end = "createdAtEnd")
@Schema(description = "登录日志查询DTO")
@Data
public class SysLoginLogQueryDTO implements java.io.Serializable{
    @Schema(description = "登录账号", example = "admin")
    private String username;
    @Schema(description = "登录IP", example = "192.168.1.1")
    private String ip;
    @Schema(description = "登录地址", example = "中国-北京-北京")
    private String location;
    @Schema(description = "浏览器", example = "Chrome")
    private String browser;
    @Schema(description = "操作系统", example = "Windows 10")
    private String os;
    @Schema(description = "状态：1-成功，0-失败", example = "1")
    @Range(min = 0, max = 1, message = "状态值只能是0或1")
    private Integer status;

    @PastOrPresent(message = "开始时间不能是未来时间")
    @Schema(description = "创建时间开始", type = "string", format = "date-time", example = "2024-01-01T00:00:00")
    private LocalDateTime createdAtStart;

    @Schema(description = "创建时间结束", type = "string", format = "date-time", example = "2024-12-31T23:59:59")
    private LocalDateTime createdAtEnd;
}
